<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="contextPath" value="<%=request.getContextPath()%>"></c:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
	<script type="text/javascript">
		window.jQuery || document.write("<script src='${contextPath}/static/ace_admin1.3.1/assets/js/jquery.min.js'>"+"<"+"/script>");
	</script>
	<script src="${contextPath}/static/js/jquery.validate.min.js"></script>
	<script type="text/javascript">
		$(function() {
			jQuery.validator.addMethod("abc", function(value, element, param) {
			  return this.optional(element) || (value == "abc" );   
			}, "not is abc");
			
			$("#subjectForm").validate({
				errorPlacement: function(error, element) {  
				    error.appendTo(element.parent());  
				},
				rules: {
					password: {
						required:true
					},
					confirmPassword: {
						required:true,
						equalTo: "input[name='password']"
					}
					/* name: {
						required:true
					},
					testCount: {
						required:true,
						number:true
					},
					totalTime: {
						required:true,
						number:true
					},
					totalScore: {
						required:true,
						number:true
					},
					description: {
						abc: true
						/* remote: {
							url: '${contextPath }/teacher/subjectValidate',
							type: "post",               //数据发送方式
						    dataType: "json",           //接受数据格式   
						    data: {                     //要传递的数据
						    	description: function() {
						            return $("input[name='description']").val();
						        }
						    }
						} */
						/*},
					status: {
						required: true
					} */
				}
		    });
		});
	</script>
</head>
<body>
	<form id="subjectForm" action="${contextPath }/teacher/testAddSubject" method="POST">
		<p>添加</p>
		<p><label>科目名:</label><input name="name" class="" /></p>
		<p><label>科目描述:</label><input name="description" /></p>
		<p><label>科目总题数:</label><input name="testCount" class="" /></p>
		<p><label>考试总时长:</label><input name="totalTime" class="" /></p>
		<p><label>满分总分:</label><input name="totalScore" class="" /></p>
		<p><label>密码:</label><input type="password" name="password" class="" /></p>
		<p><label>确认密码:</label><input type="password" name="confirmPassword" class="" /></p>
		<p><label>分数:</label><input name="score.score" class="" /></p>
		<p><label>是否开启考试:</label><input type="checkbox" name="status" value="1" />是<input type="checkbox" name="status" value="0"/>否</p>
		<button type="submit">提交</button>
	</form>
</body>
</html>